package com.gitee.proxy.handler.proxy;

import io.netty.channel.ChannelFuture;

import java.util.ArrayList;
import java.util.List;

//@Data
public class ProxyHttpRequest {

    private String host;

    private int port;

    private boolean isConnect = false;

    private boolean isHttps = false;

    /**
     * 客户端连接返回对象
     */
    private ChannelFuture clientChannelFuture;

    /**
     * request 数据
     * {@link io.netty.handler.codec.http.FullHttpRequest}
     * 包含 {@link io.netty.handler.codec.http.HttpRequest}
     * 多个HttpContent
     * LastHttpContent
     */
    private List<Object> msgList = new ArrayList<Object>();

    private ProxyHttpRequestDataHandler handler;

    public ProxyHttpRequest(ProxyHttpRequestDataHandler handler) {
        this.handler = handler;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public ChannelFuture getClientChannelFuture() {
        return clientChannelFuture;
    }

    public void setClientChannelFuture(ChannelFuture clientChannelFuture) {
        this.clientChannelFuture = clientChannelFuture;
    }

    public List<Object> getMsgList() {
        return msgList;
    }

    public void setMsgList(List<Object> msgList) {
        this.msgList = msgList;
    }

    public ProxyHttpRequestDataHandler getHandler() {
        return handler;
    }

    public void setHandler(ProxyHttpRequestDataHandler handler) {
        this.handler = handler;
    }

    public boolean isConnect() {
        return isConnect;
    }

    public void setConnect(boolean connect) {
        isConnect = connect;
    }

    public void close() {
        if (this.clientChannelFuture != null) {
            this.clientChannelFuture.channel().close();
        }
    }

    public boolean isHttps() {
        return isHttps;
    }

    public void setHttps(boolean https) {
        isHttps = https;
    }
}
